//
// Created by wsl on 2024/3/8.
//

#ifndef __DATASTRUCTURE_LINKSTACK_H
#define __DATASTRUCTURE_LINKSTACK_H

#include "DataStructure_common.h"

#define LinkStack_Create(T)                LinkStack_create(sizeof (T))

//链表节点
typedef struct LinkStack_N {
	T data;                                    //数据域
	struct LinkStack_N *next;                //指针域，下一个节点地址
} LinkStack_N, *LinkStack_Node;

//链表对象
typedef struct {
	LinkStack_Node head;                //头指针

	int length;                            //节点数量
	size_t dataSize;                    //数据域大小

} LinkSTK, *LinkStack;

DataStructure_Warning_Unused
LinkStack LinkStack_create(size_t dataSize);

DataStructure_Warning_Unused
Status LinkStack_isEmpty(LinkStack list);

DataStructure_Warning_Unused
Status LinkStack_push(LinkStack list, T e);

DataStructure_Warning_Unused
Status LinkStack_pop(LinkStack list, T buf);

DataStructure_Warning_Unused
Status LinkStack_top(LinkStack list, T e);

DataStructure_Warning_Unused
Status LinkStack_clear(LinkStack list);

DataStructure_Warning_Unused
Status LinkStack_destroy(LinkStack *list);

#endif //__DATASTRUCTURE_LINKSTACK_H
